import axios from "axios";

/* 创建axios实例 */
const request = axios.create({
  baseURL: "https://book.youbaobao.xyz:18082",
  timeout: "8000",
});

/* 请求拦截器 */
request.interceptors.request.use(
  (config) => {
    return config;
  },
  (err) => {
    return Promise.reject(err);
  }
);

/* 响应拦截器 */
request.interceptors.response.use(
  (res) => {
    return res.data;
  },
  (err) => {
    return Promise.reject(err);
  }
);

export default request;
